<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		
		<button onclick="foo1()">打开窗口</button>
		<button onclick="foo2()">关闭窗口</button>
		
		<script>
			
			var w;
			
			function foo1(){
				
				w = window.open("new_page.html","new","width=100,height=50");
				
				var w2 = screen.width;
				var h2 = screen.height;
				
				w.moveTo((w2-200)/2,(h2-100)/2);
				
			}
			
			function foo2(){
				
				w.close();
				
			}
			
			
			
		</script>
		
	</body>
</html>